<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org/">
<head>
    <meta charset="UTF-8">
    <title>结算页面</title>

    <base href="http://localhost:81/resources/front/">

    <link rel="stylesheet" type="text/css" href="css/style.css"/>
    <link rel="stylesheet" type="text/css" href="css/shopping-mall-index.css"/>
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/zhonglin.js"></script>


    <script type="text/javascript" src="http://localhost:81/resources/back/lib/layer/1.9.3/layer.js"></script>
    <script src="http://localhost:81/resources/back/js/AjaxUtlis.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src="js/shopTitle.js"></script>

    <script>
        $(function () {
            // 新增地址信息
            $("#save_address").click(function () {

                // 1.获取数据
                var address = $("#p_address").val();
                var phone = $("#p_phone").val();
                var name = $("#p_name").val();
                var def = $("#p_def").prop("checked");

                // 2.封装
                var param = new Object();
                param.address = address.trim();
                param.phone = phone;
                param.name = name;
                param.def = def ? 1 : 0;

                // 3.发送
                post("address/addAddress", param, function (resp) {
                    if (resp.code == 0) {
                        layer.msg('添加成功', {icon: 1, time: 1000},function () {
                            location.reload();
                        });
                    }
                });
            });

            // 提交订单到支付页面
            $("#submitOrders").click(function () {
                // 1.获取数据(用户选择的收货|地址id,支付方式，勾选的商品)

                var aId = $(".pay-dz").find(".current").attr("aId");
                var payType = $("[name=pay_type]:checked").val();
                var selectGid = "[[${#request.getParameter('key')}]]";

                // 2.判断
                if (!aId || !payType) {
                    layer.msg('地址或支付方式没有选择', {icon: 3, time: 1500});
                    return;
                }
                // 封装数据
                var param = new Object();
                param.aid = aId;
                param.payType = payType;
                param.selectGid = selectGid;
                // 3.发送请求

                post("order/orderCreate", param, function (resp) {
                    if (resp.code == 0) {
                        var oid = resp.orderId;
                        location.href = "http://localhost:81/pay/ali?orderId="+oid; // 跳转支付页面
                    }
                });
            });


            // 修改地址
        })
        //删除地址
        function delAddress() {
            var aId = $(".pay-dz").find(".current").attr("aId");
            layer.confirm('确定删除该地址？', {icon: 5, title:'如果误点请取消'}, function(index){
                //do something
                get("address/deleteById?aid="+ aId, function (resp) {
                    if (resp.code == 0) {
                        layer.msg('删除成功！', {icon: 1, time: 1500},function () {
                            // 商品添加成功就刷新页面
                            location.reload();
                        });
                    }
                });
                layer.close(index);
            });
        }
    </script>

</head>
<body style="position:relative;">

<!--top 开始-->
<div class="top">
    <div class="top-con w1200" id="shopTitle">
    </div>
</div>

<!--logo search 开始-->
<div class="hd-info1 w1200">
    <div class="logo f-l">
        <h1><a href="#" title="中林网站"><img src="images/logo.jpg" /></a></h1>
    </div>
    <div class="search f-r">
        <ul class="sp">
            <li class="current" ss-search="sp"><a href="JavaScript:;">商品</a></li>
            <li ss-search="dp"><a href="JavaScript:;">店铺</a></li>
            <div style="clear:both;"></div>
        </ul>
        <div class="srh">
            <div class="ipt f-l">
                <input type="text" placeholder="搜索商品..." ss-search-show="sp" />
                <input type="text" placeholder="搜索店铺..." ss-search-show="dp" style="display:none;" />
            </div>
            <button class="f-r">搜 索</button>
            <div style="clear:both;"></div>
        </div>
        <ul class="sp2">
            <li><a href="#">绿豆</a></li>
            <li><a href="#">大米</a></li>
            <li><a href="#">驱蚊</a></li>
            <li><a href="#">洗面奶</a></li>
            <li><a href="#">格力空调</a></li>
            <li><a href="#">洗发护发</a></li>
            <li><a href="#">葡萄 </a></li>
            <li><a href="#">脉动</a></li>
            <li><a href="#">海鲜水产</a></li>
            <div style="clear:both;"></div>
        </ul>
    </div>
    <div style="clear:both;"></div>
</div>

<!--切换城市-->
<div class="switch-city w1200">
    <a href="#" class="dianji-qh">切换城市</a>
    <span class="dqm">重庆市</span>
    <div class="select-city">
        <div class="sl-city-top">
            <p class="f-l">切换城市</p>
            <a class="close-select-city f-r" href="#">
                <img src="images/close-select-city.gif" />
            </a>
        </div>
        <div class="sl-city-con">
            <p>西北</p>
            <dl>
                <dt>重庆市</dt>
                <dd>
                    <a href="#">长寿区</a>
                    <a href="#">巴南区</a>
                    <a href="#">南岸区</a>
                    <a href="#">九龙坡区</a>
                    <a href="#">沙坪坝区</a>
                    <a href="#">北碚</a>
                    <a href="#">江北区</a>
                    <a href="#">渝北区</a>
                    <a href="#">大渡口区</a>
                    <a href="#">渝中区</a>
                    <a href="#">万州</a>
                    <a href="#">武隆</a>
                    <a href="#">晏家</a>
                    <a href="#">长寿湖</a>
                    <a href="#">云集</a>
                    <a href="#">华中</a>
                    <a href="#">林封</a>
                    <a href="#">双龙</a>
                    <a href="#">石回</a>
                    <a href="#">龙凤呈祥</a>
                    <a href="#">朝天门</a>
                    <a href="#">中华</a>
                    <a href="#">玉溪</a>
                    <a href="#">云烟</a>
                    <a href="#">红塔山</a>
                    <a href="#">真龙</a>
                    <a href="#">天子</a>
                    <a href="#">娇子</a>
                </dd>
                <div style="clear:both;"></div>
            </dl>
            <dl>
                <dt>新疆</dt>
                <dd>
                    <a href="#">齐乌鲁木</a>
                    <a href="#">昌吉</a>
                    <a href="#">巴音</a>
                    <a href="#">郭楞</a>
                    <a href="#">伊犁</a>
                    <a href="#">阿克苏</a>
                    <a href="#">喀什</a>
                    <a href="#">哈密</a>
                    <a href="#">克拉玛依</a>
                    <a href="#">博尔塔拉</a>
                    <a href="#">吐鲁番</a>
                    <a href="#">和田</a>
                    <a href="#">石河子</a>
                    <a href="#">克孜勒苏</a>
                    <a href="#">阿拉尔</a>
                    <a href="#">五家渠</a>
                    <a href="#">图木舒克</a>
                    <a href="#">库尔勒</a>
                </dd>
                <div style="clear:both;"></div>
            </dl>
            <dl>
                <dt>甘肃</dt>
                <dd>
                    <a href="#">兰州</a>
                    <a href="#">天水</a>
                    <a href="#">巴音</a>
                    <a href="#">白银</a>
                    <a href="#">庆阳</a>
                    <a href="#">平凉</a>
                    <a href="#">酒泉</a>
                    <a href="#">张掖</a>
                    <a href="#">武威</a>
                    <a href="#">定西</a>
                    <a href="#">金昌</a>
                    <a href="#">陇南</a>
                    <a href="#">临夏</a>
                    <a href="#">嘉峪关</a>
                    <a href="#">甘南</a>
                </dd>
                <div style="clear:both;"></div>
            </dl>
            <dl>
                <dt>宁夏</dt>
                <dd>
                    <a href="#">银川</a>
                    <a href="#">吴忠</a>
                    <a href="#">石嘴山</a>
                    <a href="#">中卫</a>
                    <a href="#">固原</a>
                </dd>
                <div style="clear:both;"></div>
            </dl>
            <dl>
                <dt>青海</dt>
                <dd>
                    <a href="#">西宁</a>
                    <a href="#">海西</a>
                    <a href="#">海北</a>
                    <a href="#">果洛</a>
                    <a href="#">海东</a>
                    <a href="#">黄南</a>
                    <a href="#">玉树</a>
                    <a href="#">海南</a>
                </dd>
                <div style="clear:both;"></div>
            </dl>
        </div>
    </div>
</div>

<!--内容开始-->
<div class="payment-interface w1200">

    <!--收货地址-->
    <div class="pay-info">
        <div class="info-tit">
            <h3>选择收货地址</h3>
        </div>
        <ul class="pay-dz">
            <li th:attr="aid=${address.id}" th:class="${address.def==1?'current':''}" th:each="address:${addressList}">
                <h3><span class="sp3" th:text="${address.name}"></span> 收</h3>
                <h3><p><span class="sp1" th:text="|收货地址：${address.address}|"></span></p></h3>
                <h3><p><span class="sp2" th:text="|联系方式：${address.phone}"|></span></p></h3>
                <a href="JavaScript:;" xiugai="" style="display: inline-block">修改</a>
                <a href="javascript:void(0)" onclick="delAddress()" style="display: inline-block">删除</a>
            </li>
            <div style="clear:both;"></div>
        </ul>
        <P class="pay-xgdz">修改地址和使用新地址样式一样。</P>
        <button class="pay-xdz-btn">添加新地址</button>
    </div>

    <div class="pay-info">
        <div class="info-tit" style="border-bottom:0;">
            <h3>支付方式</h3>
        </div>
        <div>
            <input type="radio" value="1" name="pay_type">银联<img style="width: 80px; height:80px;display: inline-block"
                   src="images/linepay.jpg">
            <input type="radio" value="2" name="pay_type" >微信<img style="width: 80px;height:80px;display: inline-block"
                    src="images/weixin.jpg">
            <input type="radio" value="3" name="pay_type">支付宝<img style="width: 80px;height:80px;display: inline-block"
                    src="images/zhifubao.jpg">
        </div>
    </div>


    <div class="pay-info">
        <div class="info-tit" style="border-bottom:0;">
            <h3>订单信息</h3>
        </div>
    </div>
    <div class="cart-con-info">
        <div th:each="store:${userCarVo.storeCarVoList}">
            <div class="cart-con-tit" style="margin:20px 0 5px;">
                <p class="p1" style="width:400px;">
                    <input type="checkbox" value="" name="hobby"></input>
                    <span th:text="${store.storeVo.shopName}"></span>
                </p>
            </div>
            <div class="info-mid" th:each="car:${store.carVoList}">
                <div class="mid-tu f-l">
                    <a href="#"><img width="80" height="80" th:src="${car.goodsVo.goodsPngList[0].url}"/></a>
                </div>
                <div class="mid-font f-l" style="margin-right:40px;width: 260px;">
                    <a href="#" th:text="${car.goodsVo.gname}"></a>
                </div>
                <div class="mid-sl f-l" style="margin:10px 54px 0px 0px;">
                    <input type="text" th:value="${car.count}" disabled/>
                </div>
                <p class="mid-dj f-l" th:text="|¥ ${car.goodsVo.gprice}|"></p>
                <p class="mid-je f-l" th:text="|¥ ${car.totalPrices}|" style="margin:10px 120px 0px 0px;"></p>
                <div class="mid-chaozuo f-l">
                    <select>
                        <option>送货上门</option>
                        <option>快递包邮</option>
                    </select>
                </div>
                <div style="clear:both;"></div>
            </div>
        </div>

        <div class="info-tijiao">
            <p class="p1">实付款：<span th:text="|¥ ${userCarVo.totalPrice}|">46.60</span></p>
            <button class="btn" id="submitOrders">提交订单</button>
        </div>

    </div>
</div>

<!--底部服务-->
<div class="ft-service">
    <div class="w1200">
        <div class="sv-con-l2 f-l">
            <dl>
                <dt><a href="#">新手上路</a></dt>
                <dd>
                    <a href="#">购物流程</a>
                    <a href="#">在线支付</a>
                </dd>
            </dl>
            <dl>
                <dt><a href="#">配送方式</a></dt>
                <dd>
                    <a href="#">货到付款区域</a>
                    <a href="#">配送费标准</a>
                </dd>
            </dl>
            <dl>
                <dt><a href="#">购物指南</a></dt>
                <dd>
                    <a href="#">常见问题</a>
                    <a href="#">订购流程</a>
                </dd>
            </dl>
            <dl>
                <dt><a href="#">售后服务</a></dt>
                <dd>
                    <a href="#">售后服务保障</a>
                    <a href="#">退款说明</a>
                    <a href="#">新手选购商品总则</a>
                </dd>
            </dl>
            <dl>
                <dt><a href="#">关于我们</a></dt>
                <dd>
                    <a href="#">投诉与建议</a>
                </dd>
            </dl>
            <div style="clear:both;"></div>
        </div>
        <div class="sv-con-r2 f-r">
            <p class="sv-r-tle">187-8660-5539</p>
            <p>周一至周五9:00-17:30</p>
            <p>（仅收市话费）</p>
            <a href="#" class="zxkf">24小时在线客服</a>
        </div>
        <div style="clear:both;"></div>
    </div>
</div>

<!--底部 版权-->
<div class="footer w1200">
    <p>
        <a href="#">关于我们</a><span>|</span>
        <a href="#">友情链接</a><span>|</span>
        <a href="#">宅客微购社区</a><span>|</span>
        <a href="#">诚征英才</a><span>|</span>
        <a href="#">商家登录</a><span>|</span>
        <a href="#">供应商登录</a><span>|</span>
        <a href="#">热门搜索</a><span>|</span>
        <a href="#">宅客微购新品</a><span>|</span>
        <a href="#">开放平台</a>
    </p>
    <p>
        沪ICP备13044278号<span>|</span>合字B1.B2-20130004<span>|</span>营业执照<span>|</span>互联网药品信息服务资格证<span>|</span>互联网药品交易服务资格证
    </p>
</div>

<!--确认订单（新增地址）-->
<div class="confirmation-tanchuang" xgdz1="">
    <div class="tanchuang-bg"></div>
    <div class="tanchuang-con">
        <div class="tc-title">
            <h3>新增地址</h3>
            <a href="JavaScript:;" dz-guan=""><img src="images/close-select-city.gif"/></a>
            <div style="clear:both;"></div>
        </div>
        <ul class="tc-con2">
            <li class="tc-li1">
                <p class="l-p">详细地址<span>*</span></p>
                <textarea id="p_address" class="textarea1" placeholder="请如实填写您的详细信息，如街道名称、门牌号、楼层号和房间号。">江西省赣州市于都县</textarea>
                <div style="clear:both;"></div>
            </li>

            <li class="tc-li1">
                <p class="l-p">收货人姓名<span>*</span></p>
                <input type="text" id="p_name" value="赵六"/>
                <div style="clear:both;"></div>
            </li>
            <li class="tc-li1">
                <p class="l-p">联系电话<span>*</span></p>
                <input type="text" id="p_phone" value="15362536547"/>
                <div style="clear:both;"></div>
            </li>

            <li class="tc-li1">
                <p class="l-p">默认<span></span></p>
                <input type="checkbox" id="p_def" value="1"/>
                <div style="clear:both;"></div>
            </li>
        </ul>
        <button class="btn-pst2" id="save_address">保存</button>
    </div>
</div>

<!--修改地址-->
<div class="confirmation-tanchuang" xgdz2="">
    <div class="tanchuang-bg"></div>
    <div class="tanchuang-con">
        <div class="tc-title">
            <h3>新增地址</h3>
            <a href="JavaScript:;" dz-guan=""><img src="images/close-select-city.gif" /></a>
            <div style="clear:both;"></div>
        </div>
        <ul class="tc-con2">

            <li class="tc-li1">
                <p class="l-p">详细地址<span>*</span></p>
                <textarea class="textarea1" placeholder="请如实填写您的详细信息，如街道名称、门牌号、楼层号和房间号。"></textarea>
                <div style="clear:both;"></div>
            </li>
            <li class="tc-li1">
                <p class="l-p">邮政编码<span></span></p>
                <input type="text" />
                <div style="clear:both;"></div>
            </li>
            <li class="tc-li1">
                <p class="l-p">收货人姓名<span>*</span></p>
                <input type="text" class="shxm" />
                <div style="clear:both;"></div>
            </li>
            <li class="tc-li1">
                <p class="l-p">联系电话<span>*</span></p>
                <input type="text" class="lxdh" />
                <div style="clear:both;"></div>
            </li>
        </ul>
        <button class="btn-pst2">保存</button>
    </div>
</div>
</body>
</html>